//
// Created by gastonfeng on 2023/6/19.
//

#ifndef RTE_KT1260A_CANOPEN_H
#define RTE_KT1260A_CANOPEN_H
#ifdef USE_CANOPEN
#include "canfestival.h"
#endif
typedef struct {
#ifdef USE_CANOPEN
    UNS8(*setState)(CO_Data *d, e_nodeState newState);

    e_nodeState (*getState)(CO_Data *d);

    void (*setNodeId)(CO_Data *d, UNS8 nodeId);

    UNS8 (*getNodeId)(CO_Data *d);

    TIMER_HANDLE (*SetAlarm)(CO_Data *d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period);

    UNS8 (*masterSendNMTstateChange)(CO_Data *d, UNS8 nodeId, UNS8 cs);

    void (*StopTimerLoop)(TimerCallback_t Callback);

    int (*canClose)(CO_Data *d);

    CAN_HANDLE (*canOpen)(s_BOARD *board, CO_Data *d);

    void (*TimerCleanup)();

    LIB_HANDLE (*LoadCanDriver)(char *driver_name);

    void (*TimerInit)();

    void (*StartTimerLoop)(TimerCallback_t Callback);

    void (*EnterMutex)();

    void (*LeaveMutex)();

    UNS8 (*sendSYNCMessage)(CO_Data *d);

    UNS8 (*proceedSYNC)(CO_Data *d);

    void (*_RxPDO_EventTimers_Handler)(CO_Data *d, UNS32 pdoNum);
#endif
} canopen_abi_t;


#endif //RTE_KT1260A_CANOPEN_H
